import {lsHttp} from "../utils/lshttp";

// 省钱小报
export const getReportAPI = () => {
    return lsHttp({
        url: '/api/distribution/report',
        method: 'POST',
    },false)
}

// 获取排行榜列表
export const getRankListAPI = (data) => {
    return lsHttp({
        url: '/api/distribution/rank',
        method: 'POST',
        data: data
    },false)
}


// 我的团员列表
export const getMyMembersAPI = () => {
    return lsHttp({
        url: '/api/distribution/myMembers',
        method: 'POST',
    },false)
}


// 我的省钱
export const getMyMoneyAPI = () => {
    return lsHttp({
        url: '/api/distribution/my',
        method: 'POST',
        isMyMoney: true,
    },false)
}

// 获取团队信息
export const getRulesAPI = (city) => {
    return lsHttp({
        url: '/api/distribution/rules',
        method: 'POST',
        data: {city}
    },false)
}

// 获取团队分享海报
export const getShareAPI = () => {
    let client = "applet_wechat"
    // // #ifdef H5
    // client = 'h5'
    // // #endif
    // // #ifdef APP-PLUS
    // client = 'app'
    // // #endif
    // // #ifdef MP
    // client = 'applet_wechat'
    // #endif
    return lsHttp({
        url: '/api/distribution/poster',
        method: 'POST',
        isPoster: true,
        data: {client: client}
    })
}

// 我的收益明细
export const getIncomeDetailsAPI = (limit, page) => {
    return lsHttp({
        url: '/api/distribution/incomeDetails',
        method: 'POST',
        data: {
            limit,
            page
        }
    })
}
// 获取排行榜列表
export const getRankListAllAPI = (limit, page, type) => {
    return lsHttp({
        url: '/api/distribution/rank',
        method: 'POST',
        data: {
            limit,
            page,
            type
        }
    })
}
// 获取我的排行榜列表
export const getMyRankAllAPI = (type) => {
    return lsHttp({
        url: '/api/distribution/myRank',
        method: 'POST',
        data: {
            type
        }
    })
}
// 获取我的团员列表
export const getMyMembersPageAPI = (data) => {
    return lsHttp({
        url: '/api/distribution/myMembers',
        method: 'POST',
        data: data
    },false)
}
// 获取我的邀请码
export const getInviteCodeAPI = () => {
    return lsHttp({
        url: '/api/distribution/getInviteCode',
        method: 'POST'
    })
}
// 绑定邀请码
export const codeBindAPI = (invite_code) => {
    return lsHttp({
        url: '/api/user/codeBind',
        method: 'POST',
        data: {invite_code}
    })
}
// 报名大活动
export const getJoinActivitiesAPI = (data) => {
    return lsHttp({
        url: '/api/Challenge/joinActivities',
        method: 'POST',
        // 重定义返回数据
        isData: true,
        data: {
            user_id: data.user_id,
            city: data.city,
        },
    })
}
// 获取大活动列表
export const getActivitiesAPI = (data) => {
    return lsHttp({
        url: '/api/challenge/getActivities',
        method: 'POST',
        isData: true,// 重定义返回数据
        data,
    })
}
